import request from "@/utils/request";
import {DeleteByIdRes, QueryParams, QueryRes, SaveParams, SaveRes} from "@/api/base/station/type";

/**
 * 新增车站
 * @param {object} params TrainStationSaveReq
 * @param {number} params.id
 * @param {string} params.trainCode
 * @param {number} params.index
 * @param {string} params.name
 * @param {string} params.namePinyin
 * @param {object} params.inTime
 * @param {object} params.outTime
 * @param {object} params.stopTime
 * @param {number} params.km
 * @param {object} params.createTime
 * @param {object} params.updateTime
 * @returns
 */
export function save(params: SaveParams): Promise<SaveRes> {
    return request.post(`/business/admin/station/save`, params);
}

/**
 * 查询车站列表
 * @param {object} params TrainStationQueryReq
 * @param {number} params.pageNum
 * @param {number} params.pageSize
 * @returns
 */
export function query(params: QueryParams): Promise<QueryRes> {
    return request.post(`/business/admin/station/quest-list`, params);
}

/**
 * 删除车站
 * @param {string} id
 * @returns
 */
export function deleteById(id: number): Promise<DeleteByIdRes> {
    return request.delete(`/business/admin/station/delete/${id}`);
}